//
//  LCFileModel.m
//  LongChain
//
//  Created by fengzi on 2018/7/17.
//  Copyright © 2018年 FengZi. All rights reserved.
//

#import "LCFileModel.h"

@implementation LCFileModel

- (LCFileModel *)configModelWithParameter:(id)parameter {
    
    NSString *file_id = [NSString stringWithFormat:@"%@",parameter[@"file_id"]];
    NSString *name = [NSString stringWithFormat:@"%@",parameter[@"name"]];
    NSString *url = [NSString stringWithFormat:@"%@",parameter[@"url"]];
    NSString *updateTime = [NSString stringWithFormat:@"%@",parameter[@"time"]];
    LCFileModel *model = [[LCFileModel alloc]init];
    model.fileID = file_id;
    model.fileName = name;
    model.fileURL = url;
    model.updateTime = updateTime;
    return model;
}

+ (LCFileModel *)configModelWithParameter:(id)fileInfo state:(BOOL)state {
    
    
    
    LCLog(@"fileInfo = %@",fileInfo);
//    "file_id" = 37;
//    name = "1531326900.png";
//    size = 20244;
//    thumbnail = "/api/v0/nas/thumbnail?width=200&height=200&sid=ZXlKaGJHY2lPaUpJVXpJMU5pSXNJblI1Y0NJNklrcFhWQ0o5LmV5SmxlSEFpT2pFMU16UXhOVFE1TkRZc0ltbGhkQ0k2TXpjc0ltbHpjeUk2SW5wbWMyUmhNamhtT1RFM01UTTBNU0o5LmtYcHZXYzNZTnZ4Z2IzcXV3S05LT3lrWnBJSGhHclJ0R28tV2RLQ0dIQkk=";
//    time = "2018-07-11 16:35:15";
//    url = "/api/v0/nas/file/download?sid=ZXlKaGJHY2lPaUpJVXpJMU5pSXNJblI1Y0NJNklrcFhWQ0o5LmV5SmxlSEFpT2pFMU16UXhOVFE1TkRZc0ltbGhkQ0k2TXpjc0ltbHpjeUk2SW5wbWMyUmhNamhtT1RFM01UTTBNU0o5LmtYcHZXYzNZTnZ4Z2IzcXV3S05LT3lrWnBJSGhHclJ0R28tV2RLQ0dIQkk=";

    LCFileModel *model = [[self alloc]init];
    NSString *fileID = [NSString stringWithFormat:@"%@",fileInfo[@"file_id"]];
    NSString *name = [NSString stringWithFormat:@"%@",fileInfo[@"name"]];
//    NSString *size = [NSString stringWithFormat:@"%@",fileInfo[@"size"]];
    NSString *thumbnail = [NSString stringWithFormat:@"%@",fileInfo[@"thumbnail"]];
//    NSString *time = [NSString stringWithFormat:@"%@",fileInfo[@"time"]];
    NSString *url = [NSString stringWithFormat:@"%@",fileInfo[@"url"]];
    model.fileURL = url;
    model.thumbnail = thumbnail;
    model.fileID = fileID;
    model.fileName = name;
    model.fileSelectedState = NO;
    return model;
    
}
@end
